From: Keir Fraser Date: Thu, 21 Jan 2010 14:40:05 +0000 (+0000) Subject: xend: Dis-allow device assignment if PoD is enabled. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12705 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ec789523749;p=xen.git xend: Dis-allow device assignment if PoD is enabled. Signed-off-by: Dongxiao Xu --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 89316337ab..491a940117 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -390,6 +390,14 @@ class XendDomainInfo: self.domid = domid self.guest_bitsize = None self.alloc_mem = None + + maxmem = self.info.get('memory_static_max', 0) + memory = self.info.get('memory_dynamic_max', 0) + + if maxmem > memory: + self.pod_enabled = True + else: + self.pod_enabled = False #REMOVE: uuid is now generated in XendConfig #if not self._infoIsSet('uuid'): @@ -694,11 +702,18 @@ class XendDomainInfo: return self.hvm_pci_device_insert_dev(new_dev) + def iommu_check_pod_mode(self): + """ Disallow PCI device assignment if pod is enabled. """ + if self.pod_enabled: + raise VmError("failed to assign device since pod is enabled") + def pci_dev_check_assignability_and_do_FLR(self, config): """ In the case of static device assignment(i.e., the 'pci' string in guest config file), we check if the device(s) specified in the 'pci' can be assigned to guest or not; if yes, we do_FLR the device(s). """ + + self.iommu_check_pod_mode() pci_dev_ctrl = self.getDeviceController('pci') return pci_dev_ctrl.dev_check_assignability_and_do_FLR(config) @@ -708,6 +723,8 @@ class XendDomainInfo: the device. """ + self.iommu_check_pod_mode() + # Test whether the devices can be assigned pci_name = pci_dict_to_bdf_str(new_dev)